 package sza.oracle.apps.ap.oie.lov.server;
 
 import java.io.PrintStream;
 import java.sql.CallableStatement;
 import java.sql.SQLException;
 import java.util.Enumeration;
 import oracle.apps.ap.oie.lov.server.AvailableAdvancesAMImpl;
 import oracle.apps.ap.oie.lov.server.AvailableAdvancesVOImpl;
 import oracle.apps.fnd.framework.OAException;
 import oracle.apps.fnd.framework.server.OADBTransactionImpl;
 import oracle.jbo.domain.Number;
 import oracle.jdbc.internal.OracleCallableStatement;
 
 public class SzaAvailableAdvancesAMImpl extends AvailableAdvancesAMImpl
 {
   public static void main(String[] args)
   {
     launchTester("sza.oracle.apps.ap.oie.lov.server", "SzaAvailableAdvancesAMLocal");
   }
 
   public void initAvailableAdvancesVO()
   {
     System.out.println("SZA initAvailableAdvancesVO - Start");
 
     OADBTransactionImpl localOADBTransactionImpl = (OADBTransactionImpl)getOADBTransaction();
 
     String PaymentCurrencyCode = (String)localOADBTransactionImpl.getValue("PaymentCurrencyCode");
 
     Number EmployeeId = null;
     Number ReportHeaderId = null;
     Number VendorId = null;
     try
     {
       EmployeeId = new Number((String)localOADBTransactionImpl.getValue("EmployeeId"));
 
       ReportHeaderId = new Number((String)localOADBTransactionImpl.getValue("ReportHeaderId"));
 
       System.out.println("SZA localOADBTransactionImpl.getValueNames() - Start");
       Enumeration listValueName = localOADBTransactionImpl.getValueNames();
       while (listValueName.hasMoreElements())
       {
         String ElementName = (String)listValueName.nextElement();
         System.out.println(ElementName + "=" + localOADBTransactionImpl.getValue(ElementName));
       }
 
       String SQLString = "begin sza_oie_util_pkg.GetExpenseReportVendorID(p_Report_Header_Id => :1, p_vendor_id => :2); end; ";
 
       CallableStatement callableStatement = localOADBTransactionImpl.createCallableStatement(SQLString, 1);
       try
       {
         callableStatement.setInt(1, ReportHeaderId.intValue());
 
         ((OracleCallableStatement)callableStatement).registerOutParameter(2, 4);
 
         callableStatement.execute();
 
         VendorId = new Number(callableStatement.getInt(2));
       }
       catch (SQLException localSQLException)
       {
         throw OAException.wrapperException(localSQLException);
       }
       finally
       {
         try
         {
           callableStatement.close();
         }
         catch (Exception localException1)
         {
           throw OAException.wrapperException(localException1);
         }
       }
 
       System.out.println("**VendorId=" + VendorId.toString());
 
       System.out.println("SZA localOADBTransactionImpl.getValueNames() - Start");
     }
     catch (Exception localException)
     {
       throw OAException.wrapperException(localException);
     }
     AvailableAdvancesVOImpl localAvailableAdvancesVOImpl = getAvailableAdvancesVO();
 
     if (localAvailableAdvancesVOImpl != null)
     {
       localAvailableAdvancesVOImpl.initVO(VendorId, PaymentCurrencyCode, ReportHeaderId);
     }
 
     System.out.println("EmployeeId:" + EmployeeId.toString());
     System.out.println("VendorId:" + VendorId.toString());
     System.out.println("PaymentCurrencyCode:" + PaymentCurrencyCode.toString());
     System.out.println("ReportHeaderId:" + ReportHeaderId.toString());
 
     System.out.println("SZA initAvailableAdvancesVO - End");
   }
 
   public AvailableAdvancesVOImpl getAvailableAdvancesVO()
   {
     return (AvailableAdvancesVOImpl)findViewObject("AvailableAdvancesVO");
   }
 }



